package nix.struts.api;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class Demo1Action extends ActionSupport {

	@Override
	public String execute() throws Exception {

		// Request域——>map（struts2不推荐使用Servlet原生Request域）
		Map<String, Object> requestScope = (Map<String, Object>) ActionContext.getContext().get("request");
		// 直接把ActionContext.getContext()当request使用，页面取值照旧
		ActionContext.getContext().put("name", "requestValue");
		// Session域——>map
		Map<String, Object> sessionScope = ActionContext.getContext().getSession();
		sessionScope.put("name", "sessionValue");
		// Application域——>map
		Map<String, Object> applicationScope = ActionContext.getContext().getApplication();
		applicationScope.put("name", "applicationValue");
		
		return SUCCESS;
	}
}
